【无标题】 |
您所在的位置:网站首页 › halcon create_ncc_model › 【无标题】 |
read_image (Image, 'fabrik') gen_region_line (RegionLines1, 349.99, 1060.69, 865.05, 1059.107) gen_region_line (RegionLines2, 330.83 ,1285.951 ,329.47 ,1072.89) intersection_lines (349.99, 1060.69, 865.05, 1059.107,330.83 ,1285.951 ,329.47 ,1072.89 , Row, Column, IsOverlapping) gen_cross_contour_xld (Cross, Row, Column, 60, 0.785398) 已知A点(Row1,Col1) 与角度(Phi), 还有C(HalfHeigh)的长度 求B点如下 dCol:=HalfHeigh*sin(Phi) dRow:=HalfHeigh*cos(Phi) gen_region_line (RegionLines,Row2, Column2, Row2+dRow, Column2+dCol) B点(Row2+dRow, Column2+dCol) ============================== TmpCtrl_Phi := atan2(200, 100) //求点与原点的X轴的夹角 deg_N:=deg(TmpCtrl_Phi) set_metrology_object_param (MetrologyHandle, 'all', 'measure_transition', 'all') 该参数指定使用暗/亮或亮/暗边缘。 private void dataGridViewAnalysis_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { if (dataGridViewAnalysis.CurrentCell.ColumnIndex == 2) { (e.Control as ComboBox).SelectedIndexChanged += DataAnalysis_SelectedIndexChanged; } } * Matching 01: BEGIN of generated code for model initialization set_system ('border_shape_models', 'false') * Matching 01: Obtain the model image read_image (Image, 'E:/下载/4倍镜400G-SM/20210417-135758.bmp') * Matching 01: build the ROI from basic regions gen_rectangle2 (ModelRegion, 608.117, 1168.64, rad(-90.8093), 296.666, 128.315) * Matching 01: reduce the model template reduce_domain (Image, ModelRegion, TemplateImage) * Matching 01: create the shape model create_shape_model (TemplateImage, 7, rad(0), rad(360), rad(0.1892), ['point_reduction_high','no_pregeneration'], 'use_polarity', [30,45,8], 3, ModelId) * Matching 01: get the model contour for transforming it later into the image get_shape_model_contours (ModelContours, ModelId, 1) * Matching 01: END of generated code for model initialization * Matching 01: BEGIN of generated code for model application * Matching 01: the following operations are usually moved into * Matching 01: that loop where the aquired images are processed * Matching 01: Find the model find_shape_model (Image, ModelId, rad(0), rad(360), 0.33, 1, 0.5, 'least_squares', [7,1], 0.8, ModelRow, ModelColumn, ModelAngle, ModelScore) * Matching 01: transform the model contours into the detected positions for MatchingObjIdx := 0 to |ModelScore| - 1 by 1 hom_mat2d_identity (HomMat) hom_mat2d_rotate (HomMat, ModelAngle[MatchingObjIdx], 0, 0, HomMat) hom_mat2d_translate (HomMat, ModelRow[MatchingObjIdx], ModelColumn[MatchingObjIdx], HomMat) affine_trans_contour_xld (ModelContours, TransContours, HomMat) dev_display (TransContours) endfor * Matching 01: Clear model when done clear_shape_model (ModelId) * Matching 01: END of generated code for model application |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |